const login = document.querySelector('.topnav_right>ul>li:nth-child(1)>a')
const register = document.querySelector('.topnav_right>ul>li:nth-child(2)>a')
const mima = localStorage.getItem('mima')
if (mima) {
    login.innerHTML = `<i class="toutiao">&#xe634;</i> 黑马先锋`
    register.innerHTML = `退出登录`
}
login.addEventListener('click', function () {
    if (login.innerHTML === `请先登录`) {
        location.href = '../html/login.html'
    } else {
        if (login.innerHTML !== `请先登录`) {
            location.href = '../html/personalCenter.html'
        }
    }
})
register.addEventListener('click', function () {
    if (login.innerHTML === `请先登录`) {
        location.href = '../html/register.html'
    } else {
        localStorage.removeItem('mima')
        location.href = '../html/login.html'
        localStorage.setItem('quit', 'quit')
    }
})
// 个人主页跳转
const nom = document.querySelector('.topnav_right>ul>li:nth-child(3)>a')
const VIP = document.querySelector('.topnav_right>ul>li:nth-child(4)>a')
nom.addEventListener('click', function () {

    if (login.innerHTML !== `请先登录`) {
        location.href = '../html/order.html'
    } else {
        location.href = '../html/login.html'
    }

})
VIP.addEventListener('click', function () {
    if (login.innerHTML !== `请先登录`) {
        location.href = '../html/personalCenter.html'
    } else {
        location.href = '../html/login.html'
    }

})
